<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <!-- import CSS -->
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

    <!-- 可选的 Bootstrap 主题文件（一般不用引入） -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">

    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</head>
<body>
<div id="app" style="height: 100%">
    <nav class="navbar navbar-default">
        <div class="container-fluid">
            <!-- Brand and toggle get grouped for better mobile display -->
            <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="#">蓝信 - Demo应用</a>
            </div>

            <!-- Collect the nav links, forms, and other content for toggling -->
            <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                <ul class="nav navbar-nav">
                    <li class="active"><a href="#">用户信息 <span class="sr-only">(current)</span></a></li>
                    <li><a href="#">管理员</a></li>
                </ul>
                <ul class="nav navbar-nav navbar-right">
                    <li><a href="https://www.lx.360.net"></a></li>
                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><span id="username">Dropdown </span><span class="caret"></span></a>
                        <ul class="dropdown-menu">
                            <li><a href="https://admin-cloud.lx.360.net">蓝信管理后台</a></li>

                            <li role="separator" class="divider"></li>
                            <li><a href="/backend/logout">退出</a></li>
                        </ul>
                    </li>
                </ul>
            </div><!-- /.navbar-collapse -->
        </div><!-- /.container-fluid -->
    </nav>


    <div class="container" style="padding:10px;border-bottom:1px solid #ccc;">
        <div class="row">
            <div class="col-md-12 col-xs-12">
                <form class="form-horizontal">
                    <div class="form-group">
                        <label  class="col-sm-2 control-label">姓名</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" id="name" >
                        </div>
                    </div>
                    <div class="form-group">
                        <label  class="col-sm-2 control-label">部门组织</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" id="orgname" >
                        </div>
                    </div>
                    <div class="form-group">
                        <label  class="col-sm-2 control-label">联系方式</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" id="phonenum" >
                        </div>
                    </div>

                </form>
            </div>
        </div>
    </div>

</div>
</body>


<!--<script type="text/javascript" src="./js/index.js"></script>-->
<!--<script type="text/javascript" src="./js/lanxin-jssdk.js"></script>-->
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script>
    $(document).ready(function(){
        // initPage();
        $.ajax(
            {
                url:"/lanxinService/getuserinfo",
                async : true ,
                cache : false,
                type : "GET",
                dataType : "json",
                success:function(data, textStatus){
                    if(data.code == 0){
                        console.log(data.name);


                    }else{
                        console.log("code != 0" + data.code);
                        console.log(data);
                        $("#username").text(data.name+ " - " + data.orgname);
                        $("#name").val(data.name);
                        $("#orgname").val(data.orgname);
                        $("#phonenum").val(data.phoneNum);

                        //$("#username").text("出错了："+data.code);
                    }
                },
                error:function(XMLHttpRequest, textStatus, errorThrown){
                    console.log("http status error for /api/v1/getuserinfo");
                   // $("#username").text("~出错了："+textStatus)
                }
            }
        );
    //     lx.config({
    //         debug: true,
    //         appId: '12714496-1048576',
    //         nonceStr:{{ .Nonce }},
    //         timestamp:{{ .Timestamp }},
    //         signature:{{ .Signature }}
    // }
    // );
    //
    //
    //     lx.ready(function(){
    //         // 调用jsapi
    //         alert("hah");
    //         onJsApiPrepared();
    //     });
    //
    //     lx.error(function(result){
    //         // 处理错误
    //         onJsApiFailed(result);
    //     });
    });

</script>

</html>